/*
Copyright (c) REBUILD <https://getrebuild.com/> and/or its owners. All rights reserved.

rebuild is dual-licensed under commercial and open source licenses (GPLv3).
See LICENSE and COMMERCIAL in the project root for license information.
*/

// ~~ 自动审批
// eslint-disable-next-line
class ContentHookUrl extends ActionContentSpec {
  static = { ...this.props }

  render() {
    return (
      <div className="auto-approval">
        <form className="simple">
          <div className="form-group row pb-1">
            <label className="col-12 col-lg-1 col-form-label text-lg-right">{$L('OutUrl')}</label>
            <div className="col-12 col-lg-8">
              <textarea className="form-control form-control-sm row4x" ref={(c) => (this._content = c)} maxLength="600"></textarea>
            </div>
          </div>
        </form>
      </div>
    )
  }

  componentDidMount() {
    const content = this.props.content
    if (content) {
      this.setState({ type: content.type ? content.type : 1 }, () => {
        $(this._content).val(content.content || '')
      })
    }
  }

  buildContent() {
    const _data = {
      content: $(this._content).val(),
    }
    return _data
  }
}


// eslint-disable-next-line no-undef
renderContentComp = function (props) {
  renderRbcomp(<ContentHookUrl {...props} />, 'react-content', function () {
    // eslint-disable-next-line no-undef
    contentComp = this
  })
}
